package com.zh.rent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zh.rent.dao.MailContentDao;
import com.zh.rent.pojo.MailContent;
import com.zh.rent.service.MailContentService;
import com.zh.rent.util.EmailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(isolation = Isolation.READ_COMMITTED)
public class MailContentServiceImpl implements MailContentService {
    @Autowired
    MailContentDao mailContentDao;

    @Override
    public PageInfo<MailContent> mailconAll(Integer pageNum, Integer pageSeiz, Map<String,Object> map) {
        PageHelper.startPage(pageNum,pageSeiz);
        List<MailContent> mailContents = mailContentDao.mailconAll();
        return new PageInfo<>(mailContents);
    }

    @Override
    public int updateMail(List<MailContent> mailContent) {
        int i = mailContentDao.updateMail(mailContent);
        return i;
    }

    @Override
    public int delMail() {
        int i = mailContentDao.delMail();
        return i;
    }

}
